
public class SimpleThread extends Thread{

	   @Override
	public void run() {
	
	    for (int i = 0; i <10; i++) {
      System.out.println(i);			
	    	
		}
	   System.out.println("custom thread completed.");
	   System.out.println(Thread.currentThread());
	    System.out.println("Priority :"+Thread.currentThread().getName() + " :"+Thread.currentThread().getPriority());
	   }
	
	public static void main(String[] args) {
		
		/*Thread thread=new Thread();  //ceating
		
		 thread.start(); s ///starting thread a//creaing separate stack  whose first method is run method
		 */
		System.out.println(Thread.currentThread().getName()+" : "+ Thread.currentThread().getPriority());
		
		
		SimpleThread simpleThread=new SimpleThread();
		simpleThread.setPriority(MIN_PRIORITY);
		simpleThread.setName("worker");
		simpleThread.start();
		
		
		ThreadGroup threadGroup= new ThreadGroup("Custom Group") ;
		threadGroup.setMaxPriority(7);
		Thread thread= new Thread(threadGroup, "myThread");
		Thread thread2=new Thread(threadGroup,"myThread2");
		thread2.setPriority(10);
		System.out.println(thread);
		System.out.println(thread2);
		System.out.println("main thread completed");
		
		
		
		
	}
}
